﻿using System;
using System.Collections.Generic;

using System.Text;

namespace DTO
{
    public class Country : BaseDTO
    {
        #region Fields
        #endregion

        #region Properties
        public string Code { get; set; }
        public string Name { get; set; }
        #endregion

        #region Constructors
        public Country () : this(0) { }
        public Country ( int id )
            : base(id)
        {
        }
        #endregion

    }
    public class State : BaseDTO
    {
        #region Fields
        #endregion

        #region Properties
        public string Code { get; set; }
        public string Name { get; set; }
        #endregion

        #region Constructors
        public State () : this(0) { }
        public State ( int id )
            : base(id)
        {
        }
        #endregion

    }
    public class LocationInfo : BaseDTO
    {
        #region Properties
        public string Address { get; set; }
        public string Street { get; set; }
        public string City { get; set; }
        public State State { get; set; }
        public Country Country { get; set; }
        public string ZipCode { get; set; }
        public string FullAddress
        {
            get
            {
                try
                {
                    return Address + ", " + City + ", " + State + ", " + ZipCode;
                }
                catch
                {
                    return null;
                }
            }
        }
        #endregion

        #region Constructors
        public LocationInfo(int id) : base(id) {}
        #endregion

        #region Public Methods
        public static LocationInfo Sample ()
        {
            return new LocationInfo(1)
            {
                Address = "8600 Freeport pkwy.",
                Street = "Suite 110",
                City = "Irving",
                State = new State()
                {
                    Code = "TX",
                    Name = "Texas"
                },
                ZipCode = "75063",
                Country = new Country()
                {
                    Code = "US",
                    Name = "United States"
                }
            };
        }
        #endregion
    }
    public class BaseDTO
    {
        #region Fields
        protected bool _changed = false;
        #endregion

        #region Properties
        public int Id
        {
            get;
            set;
        }
        public virtual bool Changed
        {
            get
            {
                return this._changed;
            }
        }
        #endregion

        #region Contructors
        public BaseDTO () { }
        public BaseDTO ( int id )
        {
            this.Id = id;
        }
        #endregion
    }
}
